<template>
    <div class="edit-device">
        <index-breadcrumb :breadcrumb-list="breadcrumbList" :isShow="true"></index-breadcrumb>
        <edit-cost :operation-list="operationList" :is-show="showStatus"></edit-cost>
    </div>
</template>

<script>
import EditCost from "./includes/EditCost";

export default {
    name: "EditCostName",
    components: {
        EditCost
    },
    data() {
        return {
            deviceData: null,
            operationList: [],
            showStatus: true,
            breadcrumbList: [
                {
                    title: "订单管理",
                    path: "/order"
                },
                {
                    title: "编辑订单成本"
                }
            ]
        };
    },
    activated() {
    },
    created() {
        this.getOperationList();
    },
    methods: {
        backShow() {
            this.showStatus = true
        },
        getOperationList() {
            this.$store.state.permissionList.forEach(item => {
                const [itemName] = item.permission.split(":");
                if (itemName === "order") {
                    this.operationList = item.list.map(listItem => {
                        return listItem.permission.split(":")[1];
                    });
                }
                if (itemName === "permission") {
                    item.list.some(listItem => {
                        const listItemType = listItem.permission.split(":")[1];
                        if (listItemType === "edit") {
                            this.operationList.push("permission:edit");
                            return true;
                        }
                        return false;
                    });
                }
            });
        }
    }
};
</script>

<style lang="sass" scoped>

</style>
